builder: Convert to g_object_notify_by_pspec
authorMatthias Clasen <mclasen@redhat.com>
Sun, 6 Sep 2015 19:04:19 +0000 (15:04 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 6 Sep 2015 21:13:25 +0000 (17:13 -0400)
This avoids pspec lookup overhead in g_object_notify.

gtk/gtkbuilder.c

index 02c2cdabc8647cc33ed1d9498984561809b3f697..5849cbe23fc390501d0633cf1d45c8281097b48a 100644 (file)
@@ -242,8 +242,11 @@ static GType gtk_builder_real_get_type_from_name (GtkBuilder  *builder,
 enum {
   PROP_0,
   PROP_TRANSLATION_DOMAIN,
+  LAST_PROP
 };
 
+static GParamSpec *builder_props[LAST_PROP];
+
 struct _GtkBuilderPrivate
 {
   gchar *domain;
@@ -283,13 +286,14 @@ gtk_builder_class_init (GtkBuilderClass *klass)
   *
   * Since: 2.12
   */
-  g_object_class_install_property (gobject_class,
-                                   PROP_TRANSLATION_DOMAIN,
-                                   g_param_spec_string ("translation-domain",
-                                                        P_("Translation Domain"),
-                                                        P_("The translation domain used by gettext"),
-                                                        NULL,
-                                                        GTK_PARAM_READWRITE));
+  builder_props[PROP_TRANSLATION_DOMAIN] =
+      g_param_spec_string ("translation-domain",
+                           P_("Translation Domain"),
+                           P_("The translation domain used by gettext"),
+                           NULL,
+                           GTK_PARAM_READWRITE);
+
+  g_object_class_install_properties (gobject_class, LAST_PROP, builder_props);
 }
 
 static void
@@ -1496,7 +1500,7 @@ gtk_builder_set_translation_domain (GtkBuilder  *builder,
   g_free (builder->priv->domain);
   builder->priv->domain = new_domain;
 
-  g_object_notify (G_OBJECT (builder), "translation-domain");
+  g_object_notify_by_pspec (G_OBJECT (builder), builder_props[PROP_TRANSLATION_DOMAIN]);
 }
 
 /**